package com.le.tester.utils;

import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

import org.springframework.stereotype.Component;


/**
 * 发送短息
 */
@Component
public class SmsUtil {

    /**
     * 返回6位验证码
     *
     * @return
     */
    public static String getCode() {
        Random random = new Random();
        int x = random.nextInt(899999);
        return String.valueOf(x + 100000);
    }

    /**
     * 返回6位验证码
     *
     * @return
     */
    public static String getRandomCode() {
        int result = ThreadLocalRandom.current().nextInt(899999);
        return String.valueOf(result + 100000);
    }

    public static void main(String[] args) {
        for (int i = 0; i < 200; i++) {
            System.out.println(SmsUtil.getRandomCode());
        }
    }

}
